package design.pattern.singleton;

import entity.Classroom;
import org.junit.Test;

/**
 * @author futao
 * Created on 2017/11/27 - 9:00.
 */
public class TestClass {
    //    @Test
//    public void test001() {
//        SingleTon singleTon = new SingleTon();
//        SingleTon singleTon1 = new SingleTon();
//        System.out.println(singleTon.hashCode());
//        System.out.println(singleTon1.hashCode());
//        System.out.println(singleTon);
//        /*==是比较两个对象是否是同一个对象，地址是否相等*/
//        System.out.println(singleTon == singleTon1);
//        /*equals()是比较两个对象的值是否相等*/
//        System.out.println(singleTon.equals(singleTon1));
//    }
    @Test
    public void test002() {
        SingleTon singleTon = SingleTon.getInstanceV2();
        SingleTon singleTon1 = SingleTon.getInstanceV2();
        System.out.println(singleTon.hashCode());
        System.out.println(singleTon1.hashCode());
        System.out.println(singleTon);
        System.out.println(singleTon1);
        /*==是比较两个对象是否是同一个对象，地址是否相等*/
        System.out.println(singleTon == singleTon1);
        /*equals()是比较两个对象的值是否相等*/
        System.out.println(singleTon.equals(singleTon1));
    }

    @Test
    public void test003() {
        Classroom classroom=new Classroom();
        classroom.getList();
        Classroom.say();

    }
}
